<?php
/**
 * Created by Alan.
 * User: Alan
 * Date: 2018\10\9 0009
 * Time: 19:06
 */

namespace app\bis\controller;


use think\Controller;

class Base extends Controller
{
    public $account;
    public function _initialize()
    {
        if(!$this->isLogin()){
           return $this->redirect(url('login/index'));
        }
    }

    public function isLogin()
    {
        //获取session
        $user = $this->getLoginUser();
        if($user && $user->id){
            return true;
        }
        return false;
    }

    public function getLoginUser()
    {
        if(!$this->account){
            $this->account = session('bisAccount', '', 'bis');
        }
        return $this->account;
    }
}